function preview(){
  var message = $("#message").val();
  var files = $("#uploaded_files > dl > input");
  var file_ids = [];
  //上传文件
  if(files != null){
    for(var i = 0;i < files.size();i ++){
      var fileid = files[i].value;
      file_ids[i] = fileid;
    }
  }
  alert(file_ids);
  $.ajax({
        url: '/topics/preview',
        data: { 'message':message,"files[]":file_ids },
        type: 'POST',
        error: function(){
          alert("error");
        },
        success: function(xml){
          $("#preview_content").html(xml);
          $("#preview_content").find("code").each(function(){
              hljs.highlightBlock(this);   
            })

          $("#preview_area").show();
        }
    });
}

function deleteUploadFile(file_id){
  $("#upload_file_" + file_id ).remove();
  if($("#uploaded_files > dl").size() == 0 ){
    $("#upload_area").hide();
  }
}
